<!-- 主题设置模板 -->

<script type="text/html" template lay-done="layui.data.sendParams(d.params);">

<form class="layui-form" style="margin-right: 30px;" lay-filter="add-submit">
  <div class="layui-form-item">
    <label class="layui-form-label">选择日期</label>
    <div class="layui-input-block">
      <input type="text" name="name" autocomplete="off" class="layui-input" placeholder="日期" lay-verify="required"
        class="layui-input" id="ID-laydate-name" required>


    </div>
  </div>

  </div>
  <div class=" layui-form-item">
    <div class="layui-input-block">
      <button type="submit" class="layui-btn" lay-submit lay-filter="add-submit">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary" aria-label="Reset">重置</button>
    </div>
  </div>
</form>

</script>
<script>

  //定义一个 lay-done 对应的全局方法，以供动态模板执行
  layui.data.sendParams = function (params) {
    let { viewId, ...param } = params;
    viewId = viewId || 'appId';

    //通过得到的参数值，做一些你想做的事
    //…

    //若需用到 layui 组件，layui.use 需写在该全局方法里面，如：
    layui.use(['admin', 'form', 'verifyset', 'laydate'], function () {

      var admin = layui.admin;
      var form = layui.form;

      var laydate = layui.laydate;
      // 渲染
      laydate.render({
        elem: '#ID-laydate-name',
        format: 'yyyy年MM月dd日'
      });

      let data = param.data;
      form.val('add-submit', {
        "name": data.name, // "name": "value"
      });

      form.on('submit(add-submit)', function (obj) {
        data.name = obj.field.name;
        params.addSubmit(data);
        return false;
      });

    });
  };
</script>